package com.shuigu.controller;

import com.shuigu.response.ShuiGuResult;
import com.shuigu.pojo.dto.UpdatePasswordDTO;
import com.shuigu.pojo.dto.UserRegisterDto;
import com.shuigu.service.ISysUserService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/user")
public class UserController {

    private final ISysUserService userService;

    public UserController(ISysUserService userService) {
        this.userService = userService;
    }

    @GetMapping("/info")
    public ShuiGuResult searchUserInfo() {
        return ShuiGuResult.success(userService.searchUserInfo());
    }

    @ApiOperation("注册用户")
    @PostMapping("/register")
    public ShuiGuResult registerUser(@RequestBody UserRegisterDto userRegisterDto) {
        return ShuiGuResult.success(userService.registerUser(userRegisterDto));
    }

    @ApiOperation("修改用户密码")
    @PutMapping("/updatePassword")
    public ShuiGuResult updatePassword(@RequestBody UpdatePasswordDTO updatePasswordDTO){
        // 修改用户密码
        return null;
    }

    @ApiOperation("忘记密码")
    @PostMapping("/forgetToPassword")
    public ShuiGuResult forgetPassword(@RequestBody UpdatePasswordDTO updatePasswordDTO){
        // 忘记密码，修改密码
        return null;
    }

}
